The present invention generally relates to databases and more specifically to an object type translator that preserves user code in structural language type definitions.
An object type translator (OTT) is used to translate database object types to structural language type definitions. For example, the OTT maps database object types to C structs and C++ class definitions. The C structs and C++ class definitions are used by the application developers in the respective host languages.
Typically, OTT for C++ generates the class definitions which have the attributes, basic accessor methods and some methods for internal use by the database interface libraries. In some cases, applications may need some additional attributes and methods for the classes that are meant for use only in the application space and should not to be persistent in the database. (e.g., some static data members, additional constructors/methods, etc.). In such cases, a user may add code in the OTT generated files. When there are changes to the server side object types or when some enhancements happen to the database interface library, the C struct or C++ class definition files need to be regenerated to reflect these changes. Typically, when the OTT is rerun, the files are generated afresh, without preserving the user-added code. Hence, the users had to manually add the code to the generated files everytime they are regenerated.
The above process includes many disadvantages. For example, the user must manually add the user code already added to the previously generated files after the files are overwritten. This is inefficient and time is lost in adding the user code that was previously added.